with v8.Class_Value, v8.Class_String, v8.Class_Stack_Trace;
with Ada.Text_IO;
package v8.CLass_Message is
   type Message (<>) is tagged limited private;
   type Pointer is access all Message;
   -- An error message.

   function Get (this : Message) return v8.Class_String.Pointer;
   -- return Local<String>

   function Get_Source_Line (this : Message) return v8.Class_String.Pointer;
   -- return Local<String>

   function Get_Script_Resource_Name (this : Message) return v8.Class_Value.Pointer;
   -- return Handle<Value>
   -- Returns the resource name for the script from where the function causing
   -- the error originates.

   function Get_Script_Data (this : Message) return v8.Class_Value.Pointer;
   -- return Handle<Value>
   -- Returns the resource data for the script from where the function causing
   -- the error originates.

   function Get_Stack_Trace (this : Message) return v8.Class_Stack_Trace.Pointer;
   -- return Handle<Stack_Trace>
   -- Exception stack trace. By default stack traces are not captured for
   -- uncaught exceptions. SetCaptureStackTraceForUncaughtExceptions allows
   -- to change this option.

   function Get_Line_Number (this : Message) return int;
   -- Returns the number, 1-based, of the line where the error occurred.

   function Get_Start_Position (this : Message) return int;
   -- Returns the index within the script of the first character where
   -- the error occurred.

   function Get_End_Position (this : Message) return int;
   -- Returns the index within the script of the last character where
   -- the error occurred.

   function Get_Start_Column (this : Message) return int;
   -- Returns the index within the line of the first character where
   -- the error occurred.

   function Get_End_Column (this : Message) return int;
   -- Returns the index within the line of the last character where
   -- the error occurred.



   procedure Print_Current_Stack_Trace (File : Ada.Text_IO.File_Type := Ada.Text_IO.Standard_Output);
   -- TODO(1245381): Print to a string instead of on a FILE.
   -- NOTE : this function work seems abnormal(nothing output)

   k_No_Line_Number_Info : aliased constant int;
   -- see Get_Line_Number

   k_No_Column_Info : aliased constant int;
   -- see Get_Start_Column and Get_End_Column

private
   type Message is tagged limited null record;

   pragma Import (CPP, Get, "_ZNK2v87Message3GetEv");
   pragma Import (CPP, Get_Source_Line, "_ZNK2v87Message13GetSourceLineEv");
   pragma Import (CPP, Get_Script_Resource_Name, "_ZNK2v87Message21GetScriptResourceNameEv");
   pragma Import (CPP, Get_Script_Data, "_ZNK2v87Message13GetScriptDataEv");
   pragma Import (CPP, Get_Stack_Trace, "_ZNK2v87Message13GetStackTraceEv");
   pragma Import (CPP, Get_Line_Number, "_ZNK2v87Message13GetLineNumberEv");
   pragma Import (CPP, Get_Start_Position, "_ZNK2v87Message16GetStartPositionEv");
   pragma Import (CPP, Get_End_Position, "_ZNK2v87Message14GetEndPositionEv");
   pragma Import (CPP, Get_Start_Column, "_ZNK2v87Message14GetStartColumnEv");
   pragma Import (CPP, Get_End_Column, "_ZNK2v87Message12GetEndColumnEv");
   pragma Import (CPP, k_No_Line_Number_Info, "_ZN2v87Message17kNoLineNumberInfoE");
   pragma Import (CPP, k_No_Column_Info, "_ZN2v87Message13kNoColumnInfoE");
end v8.Class_Message;
